package com.base.cn.platform.os.service.course.comment;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 课程反馈与评价接口
 *
 * @author SK
 */
@FeignClient(value = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface CourseCommentService extends CourseBaseService {

    /**
     * 查找课程反馈与评价列表
     *
     * @param comment 课程反馈与评价
     * @return 课程反馈与评价列表
     */
    @RequestMapping(contextPath + "/findCourseCommentList")
    List<Map<String, Object>> findCourseCommentList(@RequestBody Map<String, Object> comment,
                                                    @RequestParam("setCreator") boolean setCreator,
                                                    @RequestParam("setCourse") boolean setCourse,
                                                    @RequestParam("setCatalog") boolean setCatalog);

    /**
     * 查找课程评价列表
     *
     * @param comment 课程评价
     * @return 课程评价列表
     */
    @RequestMapping(contextPath + "/findCourseCommentPage")
    Map<String, Object> findCourseCommentPage(@RequestBody Map<String, Object> comment,
                                              @RequestParam(value = "currentPage", required = false, defaultValue = "1") Integer currentPage,
                                              @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                              @RequestParam("setCreator") boolean setCreator,
                                              @RequestParam("setCourse") boolean setCourse,
                                              @RequestParam("setCatalog") boolean setCatalog);

    /**
     * 保存课程反馈与评价
     *
     * @param comment 课程反馈与评价
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/saveCourseComment")
    Map<String, Object> saveCourseComment(@RequestBody Map<String, Object> comment);

    /**
     * 更新课程评价状态
     *
     * @param commentIds 课程评价id
     * @param status     1.显示 2.隐藏
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/updateCourseCommentStatus")
    Map<String, Object> updateCourseCommentStatus(@RequestParam("commentIds") String commentIds,
                                                  @RequestParam("status") Integer status);

    /**
     *获取课程评论数
     * @param comment 查询条件
     * @return
     */
    @RequestMapping(contextPath+"/findCommentCount")
    BigDecimal findCommentCount(Map<String, Object> comment);

    /**
     * 去评价前，先做验证
     * @param comment 需要评价的课程数据
     * @return
     */
    @RequestMapping(contextPath+"/checkCourseCommentBefore")
    Map<String, Object> checkCourseCommentBefore(@RequestBody Map<String, Object> comment);
}
